﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml;
using System.Xml.Serialization;

namespace Common.DataTypes
{
    [XmlRoot("Items")]
    public class AmazonBook
    {
        public string Keyword { get; set; }
        
        [XmlElement("ASIN")]
        public string Asin { get; set; }
        [XmlElement("DetailPageURL")]
        public string DetailPageUrl { get; set; }
        [XmlElement("SalesRank")]
        public string SalesRank { get; set; }
        [XmlElement("SmallImage")]
        public AmazonImage SmallImage { get; set; }
        [XmlElement("MediumImage")]
        public AmazonImage MediumImage { get; set; }
        [XmlElement("LargeImage")]
        public AmazonImage LargeImage { get; set; }
        [XmlElement("ItemAttributes")]
        public ItemAttributes Attributes { get; set; }
        [XmlElement("OfferSummary")]
        public ItemOfferSummary OfferSummary { get; set; }
    }

    [XmlRoot("ItemSearchResponse", Namespace = "http://webservices.amazon.com/AWSECommerceService/2005-10-05")]
    public class ItemOfferSummary {
        [XmlElement("LowestNewPrice")]
        public ListPrice LowestNewPrice { get; set; }
        [XmlElement("LowestUsedPrice")]
        public ListPrice LowestUsedPrice { get; set; }
        [XmlElement("LowestCollectiblePrice")]
        public ListPrice LowestCollectiblePrice { get; set; }
        [XmlElement("LowestRefurbishedPrice")]
        public ListPrice LowestRefurbishedPrice { get; set; }

        [XmlElement("TotalNew", Type=typeof(int))]
        public int TotalNew { get; set; }
        [XmlElement("TotalUsed", Type = typeof(int))]
        public int TotalUsed { get; set; }
        [XmlElement("TotalCollectible", Type = typeof(int))]
        public int TotalCollectible { get; set; }
        [XmlElement("TotalRefurbished", Type = typeof(int))]
        public int TotalRefurbished { get; set; }
    }

    [XmlRoot("ItemSearchResponse", Namespace = "http://webservices.amazon.com/AWSECommerceService/2005-10-05")]
    public class ItemAttributes {
        [XmlElement("Author")]
        public string Author { get; set; }
        [XmlElement("ISBN")]
        public string Isbn { get; set; }
        [XmlElement("PublicationDate")]
        public string PublicationDate { get; set; }
        [XmlElement("Publisher")]
        public string Publisher { get; set; }
        [XmlElement("ReleaseDate")]
        public string ReleaseDate { get; set; }
        [XmlElement("Manufacturer")]
        public string Manufacturer { get; set; }
        [XmlElement("ListPrice")]
        public ListPrice ListPrice { get; set; }
        [XmlElement("Title")]
        public string Title { get; set; }
        [XmlElement("Studio")]
        public string Studio { get; set; }
        [XmlElement("Label")]
        public string Label { get; set; }
        [XmlElement("Binding")]
        public string Binding { get; set; }
        [XmlElement("EAN")]
        public string EuropeanArticleNumber { get; set; }
        [XmlElement("PackageDimensions")]
        public PackageDimension PackageDimensions { get; set; }
    }

    [XmlRoot("ItemSearchResponse", Namespace = "http://webservices.amazon.com/AWSECommerceService/2005-10-05")]
    public class AmazonImage {
        [XmlElement("URL")]
        public string Url { get; set; }
        [XmlElement("Height")]
        public string Height { get; set; }
        [XmlElement("Width")]
        public string Width { get; set; }
    }

    [XmlRoot("ItemSearchResponse", Namespace = "http://webservices.amazon.com/AWSECommerceService/2005-10-05")]
    public class PackageDimension {
        public Unit Length { get; set; }
        public Unit Height { get; set; }
        public Unit Width { get; set; }
        public Unit Weight { get; set; }   
    }

    [XmlRoot("ItemSearchResponse", Namespace = "http://webservices.amazon.com/AWSECommerceService/2005-10-05")]
    public class Unit
    {
        public string UnitType { get; set; }
        public int Value { get; set; }
    }

    [XmlRoot("ItemSearchResponse", Namespace = "http://webservices.amazon.com/AWSECommerceService/2005-10-05")]
    public class ListPrice{
        public string Amount { get; set; }
        public string FormattedPrice { get; set; }
        public string CurrencyCode { get; set; }
    }
}
